파일 일부분 바꾸기 :: 자바예제모음[SSISO Community]
 
SSISO 카페 SSISO Source SSISO 구직 SSISO 쇼핑몰 SSISO 맛집
추천검색어 : JUnit   Log4j   ajax   spring   struts   struts-config.xml   Synchronized   책정보   Ajax 마스터하기   우측부분

자바예제모음
[1]
등록일:2008-05-07 09:48:57 (0%)
작성자:
제목:파일 일부분 바꾸기

import  java.io.*;

public  class  LangCode2Unicode  {

        /**
          *  junong
          */
        public  static  void  main(String[]  args)  {
                String  lang  =  args[0];
                String  target  =  args[1];
                BufferedReader  br  =  null;
                BufferedWriter  bw  =  null;
                try  {
                        br  =  new  BufferedReader(new  FileReader(target));
                        bw  =  new  BufferedWriter(new  FileWriter(target  +  lang));
                        String  str  =  "";
                        while  ((str  =  br.readLine())  !=  null)  {
                                int  startIndex  =  0;
                                if  (str.indexOf("@#")  !=  (-1))  {
                                        while  (str.indexOf("@#")  !=  -1)  {
                                                startIndex  =  str.indexOf("@#");
                                                String  strCodeNum  =  str.substring(startIndex  +  2,  str
                                                                .indexOf("#@",  startIndex));
                                                String  changeStr  =  "<script>display('"
                                                                +  LangCode2Unicode.getUni(strCodeNum,  lang)
                                                                +  "')</script>";
                                                String  changeRegEx  =  changeStr.replaceAll("\\\\",
                                                                "\\\\\\\\");
                                                str  =  str.replaceAll("@#"  +  strCodeNum  +  "#@",
                                                                changeRegEx);
                                        }
                                }
                                bw.write(str,  0,  str.length());
                                bw.newLine();
                        }
                        br.close();
                        bw.close();
                        System.out.print("end");
                }  catch  (Exception  e)  {
                        System.out.println(e);
                }  finally  {
                        bw  =  null;
                        br  =  null;
                }

        }

        private  static  String  getUni(String  strCodeNum,  String  lang)  {
                BufferedReader  langBR  =  null;
                String  uni  =  "";
                try  {

                        langBR  =  new  BufferedReader(new  FileReader(
                                        "C:/keb/ibankproject/data/lang/"  +  lang  +  ".lang"));
                        String  str  =  "";
                        while  ((str  =  langBR.readLine())  !=  null)  {
                                if  (str.indexOf(strCodeNum)  !=  (-1))  {
                                        uni  =  str.substring(9,  str.length());
                                        break;
                                }
                        }
                        langBR.close();
                }  catch  (Exception  e)  {
                        System.out.println(e);
                }
                return  uni;
        }

}

출처:  http://blog.naver.com/akswnsjd1/60043568572
[본문링크] 파일 일부분 바꾸기
[1]
코멘트(이글의 트랙백 주소:/cafe/tb_receive.php?no=7520
작성자
비밀번호

 

SSISOCommunity

[이전]

Copyright byCopyright ⓒ2005, SSISO Community All Rights Reserved.